<#assign tit><@value type="workflowType" key="${workflow.typeId!}"/></#assign>
<@page.html title=tit>
<script type="text/javascript">
  function upload() {
    openWin("upload?id=${workflow.workflowId}", 500, 350);
  }
  function viewHis() {
    openWin("viewHis?id=${workflow.workflowId}", 500, 350);
  }
  function viewFile() {
    openWin("viewFile?id=${workflow.workflowId}", 500, 350);
  }
  function cancel() {
    if(!window.confirm("确定要撤销申请吗?")) return;
    getJson("_cancel?id=${workflow.workflowId}", function(data){
      window.alert(data.msg);
      if(data.ret) cload();
    });
  }

  function hitchg() {
    var tb1 = getEl("tb_old");
    var tb2 = getEl("tb_new");
    if(!tb1 || !tb2) return;
    for(var j=0; j<tb1.rows.length; j++) {
      for(var i=0; i<tb1.rows[j].cells.length; i++) {
        if(tb1.rows[j].cells[i].innerHTML!=tb2.rows[j].cells[i].innerHTML)
          tb2.rows[j].cells[i].style.color = "#f00";
        if(i<tb1.rows[j].cells.length-1
            && (tb1.rows[j].cells[i].innerHTML=="照片" || tb1.rows[j].cells[i].innerHTML=="证件照")
            && tb1.rows[j].cells[i+1].innerHTML!=tb2.rows[j].cells[i+1].innerHTML)
          tb2.rows[j].cells[i].style.color = "#f00";
      }
    }
  }
</script>
<div style="width:<#if workflow.typeId='01' || workflow.typeId='35'>920px<#else>600px</#if>;">
  <form id="fm_input" method="post" action="_edit" onsubmit="return post(this);">
    <input type="hidden" name="id" value="${workflow.workflowId}">
    <input type="hidden" name="submit" value="1">
    <div class="kbox">
      <div id="div_detail" style="border:3px solid #ffefce; margin-bottom:10px; padding:10px 0;"></div>
      <#if workflow.status=0 && workflow.createUser=sysUser.userCode><table class="input" align="center">
        <tr>
          <th>申请原因</th>
          <td><textarea name="note" cols="40" rows="3">${workflow.note!}</textarea></td>
        </tr>
      </table></#if>
    </div>
    <div class="button"><#if workflow.status=0 && workflow.createUser=sysUser.userCode><input type="submit" value="提交申请">
      <input type="button" value="上传附件" onclick="upload();"><#if canCancel??><input type="button" value="撤销申请" onclick="cancel();"></#if>
      <#else><input type="button" value="审批历史" onclick="viewHis();">
      <#if workflow.fileNum gt 0><input type="button" value="查看附件" onclick="viewFile();"></#if></#if></div>
  </form>
</div>
<script type="text/javascript">
  loadHtml("div_detail","getDetail?id=${workflow.workflowId}", null, hitchg);
</script>
</@page.html>